package phasebook.client;

import javax.ejb.Local;
import javax.ejb.Remote;
import javax.jws.WebParam;
import javax.jws.WebService;

import lottery.msgs.LotteryResult;

import phasebook.client.msgs.MessageInfo;
import phasebook.client.msgs.PhotoInfo;
import phasebook.client.msgs.UserInfo;
import phasebook.client.msgs.MovementInfo;
import phasebook.client.msgs.UserProfileInfo;

@WebService
@Remote
public interface RemotePhasebookService{
	@Local interface LocalPhaseBookService extends RemotePhasebookService{}
	
	// Retrieve Information 

	public UserInfo[] getFriends(@WebParam(name="userId") long userId);
	
	public UserInfo[] getFriendRequests(@WebParam(name="userId")long userId);
	
	public UserInfo[] getMyFriendRequests(@WebParam(name="userId")long userId);
	
	public MovementInfo[] getFinancialMovements(@WebParam(name="userId")long userId);
	
	public MessageInfo[] getMessages(@WebParam(name="myId")long myId,@WebParam(name="userId")long userId);
		
	public UserProfileInfo getProfile(@WebParam(name="userId")long userId);
	
	public PhotoInfo[] getAlbum(@WebParam(name="userId")long userId);
	
	public UserInfo[] findUsers(@WebParam(name="userId")long userId,@WebParam(name="regEx") String regEx) throws Exception;
	
	public byte[] downloadPhoto(@WebParam(name="photoId")long photoId);
	
	// Submit Information 
	
	public long registerUser(@WebParam(name="userProfile") UserProfileInfo userProfile) throws Exception;
	
	public void updateUser(@WebParam(name="userProfile") UserProfileInfo userProfile) throws Exception;
	
	public long validateLogin(@WebParam(name="userName") String userName,@WebParam(name="password") String password) throws Exception;
	
	public void publishMessage(@WebParam(name="newMessage") MessageInfo newMessage) throws Exception;

	public void deleteMessage(@WebParam(name="userId") long userId, @WebParam(name="messageId") long messageId) throws Exception;
	
	public void requestFriendship(@WebParam(name="userId") long userId, @WebParam(name="friendId") long friendId) throws Exception;
	
	public void cancelFriendship(@WebParam(name="userId") long userId,@WebParam(name="friendId") long friendId) throws Exception;
	
	public void cancelFriendshipRequest(@WebParam(name="userId") long userId,@WebParam(name="friendId") long friendId) throws Exception;
	
	public void denyFriendshipRequest(@WebParam(name="userId") long userId,@WebParam(name="friendId") long friendId) throws Exception;
	
	public void acceptFriendshipRequest(@WebParam(name="userId")long userId,@WebParam(name="friendId") long friendId) throws Exception;

	public void addPhoto(@WebParam(name="userId") long userId,@WebParam(name="photo") PhotoInfo photo,@WebParam(name="imageData") byte[] imageData) throws Exception;
	
	public void placeBet(@WebParam(name="userId") long userId,@WebParam(name="amount") double amount,@WebParam(name="result") int result) throws Exception;
	
	public void updateBalance(@WebParam(name="userId") long userId,@WebParam(name="amount") double amount, @WebParam(name="accountId")long accountId) throws Exception;
	
	public void createFinancialMovement(@WebParam(name="userId") long userId,@WebParam(name="amount") double amount,@WebParam(name="description") String description) throws Exception;
	
	public void processResults(@WebParam(name="lotteryResults") LotteryResult[] lotteryResults) throws Exception;

	void notifyLotteryParticipants(@WebParam(name="lotteryResults") LotteryResult[] lotteryResults)	throws Exception;
}
